<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>动画模块2</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }

        div.box1{
            background-color: #f00;
            width: 100px;
            height: 100px;
            /* animation:sport 5s; */
            animation-name: sport;
            animation-duration: 5s;
            /* 相对定位后动画才有效 */
            position: absolute;
            /* 绝对定位最好给定left top的值不然有的浏览器可能不正常显示 */
            left: 0;
            top: 0;
        }

        @keyframes sport{
            0%{
                left: 0;
                top: 0;
            }

            25%{
                left: 300px;
                top: 0;
            }

            50%{
                left: 300px;
                top: 300px;
            }

            75%{
                left: 0;
                top: 300px;
            }

            100%{
                left: 0;
                top: 0;
            }
        }

        div.rotate{
            width: 200px;
            height: 200px;
            animation: zrotate 5s linear 0s normal both;
            background-color: #ff0;
            margin: 500px auto;
        }

        @keyframes zrotate{
            0%{
                transform: rotate(10deg);
            }
            50%{
                transform: rotate(50deg);
            }
            100%{
                transform: rotate(100deg);
            }
        }
    </style>
</head>
<body>
    <div class="box1"></div>
    <div class="rotate"></div>
</body>
</html>